﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Web.admin.newsClass
{
    /// <summary>
    /// SingleDelete 的摘要说明
    /// </summary>
    public class SingleDelete : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string id =context.Request.QueryString["id"];
            if (!string.IsNullOrEmpty(id)) {
                int j=SingleDel(id);
                if (j>0)
                {
                    context.Response.Write("<script>alert('删除成功,共删除"+j+"条数据');window.location.href='List.aspx'</script>");
                }
                else {
                    context.Response.Write("<script>alert('根目录不能删除');window.location.href='List.aspx'</script>");
                }
            }
            
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
        /// <summary>
        /// 根据id对一行数据进行删除
        /// </summary>
        /// <param name="id">id号</param>
        /// <returns>返回删除的行数</returns>
        protected int SingleDel(string id)
        {
            int i = 0;
            i += new BLL.NewsClass().delSingle(id);
            return i;
        }
        
    }
}